/* $RCSFile: ADNDynDiscount.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/DynEntities/ADNDynDiscount.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:32  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using CrmSdk;

namespace AddonNice.CRMWrapper
{
	public class ADNDynDiscount : DynEntity
	{
        protected class Ftor: DFactor
        {
            public Ftor() : base(CrmStr.discount)
            {}

            public override Type DynType
            { get { return typeof(ADNDynDiscount); } }

            public override string DynTypename
            {   get{ return CrmStr.discount;}}

            public override DynEntity Build()
            {   return new ADNDynDiscount();}

            public override DynEntity Build(CRMWrapperBase w, InternalDynamicEntity dEntity, PropertyDescriptorCollection wproperties)
            {   return new ADNDynDiscount(w, dEntity, wproperties, null);}

            public override DynEntity Build(CRMWrapperBase w, string PrimaryFieldValue)
            {   return new ADNDynDiscount(w);}

            public override DynEntity Build(CRMWrapperBase w,Guid PrimaryKeyValue)
            {   return new ADNDynDiscount(w,PrimaryKeyValue);}
        }

        static ADNDynDiscount(){new Ftor();} 

        public override bool HasPrimaryField
        {
            get{   return false;}
        }

        public override bool HasOwnerProperty
        {
            get{   return false;}
        }

        public override bool HasOwninguser
        {
            get{   return false;}
        }

        public override bool HasBusinessUnitProperty
        {
            get{   return false;}
        }

        public override bool HasOwningBusinessUnitProperty
        {
            get{   return false;}
        }

        public override bool OwningbusinessunitAsUniqueIdentifier
        {
            get{   return false;}
        }

        /// <summary>
		/// Reserved for template methods: do not use directly
		/// </summary>
        public ADNDynDiscount(): base()
		{}

        public ADNDynDiscount(CRMWrapperBase w)
			: base(w,CrmStr.discount)
		{
		}

		public ADNDynDiscount(CRMWrapperBase w, Guid CrmId)
			: base(w,CrmStr.discount, CrmId)
		{}

		public ADNDynDiscount(CRMWrapperBase w, InternalDynamicEntity e)

			: base(w,CrmStr.discount,e,null,null)
		{}

		public ADNDynDiscount(CRMWrapperBase w, InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s)

			: base(w,CrmStr.discount,e,prop,s)
		{}

        [CrmDynAttribute(CrmStr.discount)]
		public Guid discountid
		{
			get
			{
				return KeyPropertyValue(CrmStr.discountid);
			}
			set
			{
				AddKeyProperty(CrmStr.discountid, value);
			}
		}

        protected override void SetCrmIdProperty(Guid crmId)
        {
           if ( !dicProperty.ContainsKey(CrmStr.discountid) || KeyPropertyValue(CrmStr.discountid) != crmId )
                discountid  =   crmId;
        }

        public override Guid PrimaryKeyGuidValue
        {
           get
           {
                return discountid;
           }
           set
           {
               discountid    =   value;
           }
        }

        [CrmDynAttribute(CrmStr.discount)]
        public bool isamounttype
        {
            get
            {
                return BooleanPropertyValue(CrmStr.isamounttype);
            }
            set
            {
                AddBooleanProperty(CrmStr.isamounttype,value);
            }
        }

        [CrmDynAttribute(CrmStr.discount)]
        public decimal lowquantity
        {
            get
            {
                return DecimalPropertyValue(CrmStr.lowquantity);
            }
            set
            {
                AddDecimalProperty(CrmStr.lowquantity,value);
            }
        }
        
        [CrmDynAttribute(CrmStr.discount)]
        public decimal highquantity
        {
            get
            {
                return DecimalPropertyValue(CrmStr.highquantity);
            }
            set
            {
                AddDecimalProperty(CrmStr.highquantity,value);
            }
        }
        
        [CrmDynAttribute(CrmStr.discount)]
        public decimal percentage
        {
            get
            {
                if ( dicProperty.ContainsKey(CrmStr.percentage) )
                    return DecimalPropertyValue(CrmStr.percentage);
                return 0;
            }
            set
            {
                AddDecimalProperty(CrmStr.percentage,value);
            }
        }

        [CrmDynAttribute(CrmStr.discount)]
        public decimal amount
        {
            get
            {
                if ( dicProperty.ContainsKey(CrmStr.amount) )
                    return MoneyPropertyValue(CrmStr.amount);
                return 0;
            }
            set
            {
                AddMoneyProperty(CrmStr.amount,value);
            }
        }

        [CrmDynAttribute(CrmStr.discount)]
        public decimal exchangerate
        {
            get
            {
                return DecimalPropertyValue(CrmStr.exchangerate);
            }
            set
            {
                AddDecimalProperty(CrmStr.exchangerate,value);
            }
        }

        [CrmDynAttribute(CrmStr.discount)]
        public Guid transactioncurrencyid
        {
            get
            {
                return LookupPropertyValue(CrmStr.transactioncurrencyid);
            }
            set
            {
                AddLookupProperty(CrmStr.transactioncurrencyid,CrmStr.transactioncurrency,value);
            }
        }
        
        public string transactioncurrencyName
        {
            get
            {
                return LookupPropertyName(CrmStr.transactioncurrencyid);
            }
        }
        
        [CrmDynAttribute(CrmStr.discount)]
        public Guid discounttypeid 
        {
            get
            {
                return LookupPropertyValue(CrmStr.discounttypeid);
            }
            set
            {
                AddLookupProperty(CrmStr.discounttypeid,CrmStr.discounttype,value);
            }
        }
	}
}
